package com.jukte.recipe.share;


import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Base64;
import android.util.Log;


public class FacebookShareActivity extends FragmentActivity {
	private FbFragment mainFragment;
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);

	    if (savedInstanceState == null) {
	        // Add the fragment on initial activity setup
	        mainFragment = new FbFragment();
	        getSupportFragmentManager()
	        .beginTransaction()
	        .add(android.R.id.content, mainFragment)
	        .commit();
	    } else {
	        // Or set the fragment from restored state info
	        mainFragment = (FbFragment) getSupportFragmentManager()
	        .findFragmentById(android.R.id.content);
	    }
	    
	   
	        PackageInfo info;
			try {
				info = getPackageManager().getPackageInfo(
				      "com.jukte.reciepe", PackageManager.GET_SIGNATURES);
				 for (Signature signature : info.signatures) 
		            {
		               MessageDigest md = MessageDigest.getInstance("SHA");
		               md.update(signature.toByteArray());
		               Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
		            }
			} catch (NameNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (NoSuchAlgorithmException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	       
	        
	   
	}
	
	

}
